package com.lagou.work.task02.classloader;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * tcp通信服务器端
 */

public class ServerTest {
    private static  ExecutorService executorService = Executors.newFixedThreadPool(2);

    public static void main(String[] args) {
        ServerSocket serverSocket = null;
        Socket accept = null;
        try {
                serverSocket = new ServerSocket(8885);
                System.out.println("等待客户端连接请求...");
                accept = serverSocket.accept();
                System.out.println("客户端" + accept.getInetAddress() + "连接成功，等待发送信息...");
                new JobThread(accept).start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
